<?

/*

    This file is part of Blue Violin.

    Blue Violin is free software: you can redistribute it and/or modify
    it under the terms of the GNU Affero Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    Blue Violin is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU Affero Public License for more details.

    You should have received a copy of the GNU Affero Public License
    along with Blue Violin.  If not, see <http://www.gnu.org/licenses/>.

    Blue Violin  Copyright (C) 2008  Blue Violin, Inc. & Josh Watts <josh.watts@blueviolin.org>
	For more information, visit http://www.blueviolin.org/

    This program comes with ABSOLUTELY NO WARRANTY.

*/

session_start();
require_once("../classes/Database.php");
require_once("../general.php");

function SaveScript($sScript)
{
	$oDatabase = new Database();
	$sSQL = "select login_id " .
		"from Sessions " .
		"where session_id = '" . $_SESSION["SESSION_ID"] . "'";
	$oDatabase->ExecuteSQL($sSQL);
	$aRow = $oDatabase->NextRow();
	$nLoginID = $aRow["login_id"];
// 	echo($nLoginID);
	$sSQL = "insert into Scripts (login_id, script, timestamp) values " .
		"(" . $nLoginID . ",'" . $sScript . "', now())";
	$oDatabase->ExecuteSQL($sSQL);
}

// echo($_SESSION["SESSION_ID"]);
SaveScript($req_script);
// echo($req_script);
?>